package com.atguigu.gmall.product.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wk
 * @create 2021-08-27 21:23
 */
@Controller
@RequestMapping("/thymeleaf")
public class ThymeLeafController {
    @RequestMapping("/test")
    public String test(Model model, HttpSession session) {
        model.addAttribute("hello", "黄梅戏");
        session.setAttribute("test", "慕容小小");
        // 测试集合
        List<String> list = new ArrayList<>();
        list.add("毛不易");
        list.add("薛之谦");
        list.add("隔壁老樊");
        list.add("张宇");
        model.addAttribute("list", list);
        return "index";
    }
}
